﻿Public Delegate Function SemanticRule(ByVal context As ParserContext) As Object

Public NotInheritable Class ParserContext

    Private m_production As Production
    Public ReadOnly Property CurrentProduction() As Production
        Get
            Return m_production
        End Get
    End Property

    Private m_listOfResults As IList(Of Object)

    Public Function GetSymbolResult(ByVal symbolIndex As Integer) As Object
        Return m_listOfResults(symbolIndex)
    End Function

    Public Function GetSymbol(ByVal symbolIndex As Integer) As ProductionSymbol
        Return m_production.Sequence(symbolIndex)
    End Function

    Friend Sub New(ByVal production As Production, ByVal results As IList(Of Object))
        Debug.Assert(production.Sequence.Count = results.Count)

        m_production = production
        m_listOfResults = results
    End Sub
End Class
